package com.shuqing.download.engine.constants;

/**
 * 任务状态
 * @author wangshuqing
 * @date 2023/2/12 14:13
 */
public enum TaskStatusEnum {
    //
    NONE("-"),
    //初始化时候设置
    SLEEP("休眠"),
    //分发器处理
    QUEUE("待处理"),
    //下载引擎处理
    RUNNING("处理中"),
    SUCCESS("成功"),
    FAIL("失败");

    private String desc;

    TaskStatusEnum(String desc) {
        this.desc = desc;
    }

    public TaskStatusEnum getStatusEnumByDefault(String status){
        for(TaskStatusEnum statusEnum:values()){
            if(statusEnum.name().equals(status)){
                return statusEnum;
            }
        }
        return NONE;
    }


    public String getDesc(){
        return this.desc;
    }
}
